package com.pan.structual.decorator.decorator.impl;

import com.pan.structual.decorator.decorator.MyFrameDecorator;
import com.pan.structual.decorator.frame.MyFrame;

import javax.swing.*;
import java.awt.*;

public class YellowTextFrameDecorator extends MyFrameDecorator {
    public YellowTextFrameDecorator(MyFrame frame) {
        super(frame);
    }

    private String text;

    public YellowTextFrameDecorator(MyFrame frame, String text) {
        super(frame);
        this.text = text;
    }

    @Override
    public void disposition() {
        super.disposition();
        JFrame frame = super.getFrame();
        JLabel label = new JLabel(text);
        label.setForeground(Color.YELLOW);
        label.setFont(new Font("宋体",Font.BOLD,26));
        frame.add(label);
    }
}
